#!/bin/bash  
if [ $1 = "start" ]; then
	echo "Starting 'ee-monitor...'"
	java -jar ee-monitor.jar $2 $3 &
elif [ $1 = "stop" ]; then
	pid=`ps aux | egrep 'java -jar ee-monitor' | egrep -v 'grep' | awk '{print $2}'`
	echo "Killing 'ee-monitor' with pid: $pid"
	kill -9 $pid
	sleep 2
	pid=`ps aux | egrep 'java -jar emotion_extractor' | egrep -v 'grep' | awk '{print $2}'`
	echo "Killing 'emotion_extractor' with pid: $pid"
	kill -9 $pid
	sleep 2
elif [ $1 = "status" ]; then
	ps aux | egrep 'java -jar ee-monitor' | egrep -v 'grep'
	ps aux | egrep 'java -jar emotion_extractor' | egrep -v 'grep'
elif [ $1 = "progress" ]; then
	i="1"
	all=`find /home/mate/dp/ontozur | grep jpg | wc`
	while [ $i -gt 0 ]
	do
		#clear
		processed=`cat log/luxand_data_creator_log | grep '2013-04-05'| egrep -v 'skipping' | wc -l`
		echo "${processed} / ${all}" | awk '{print $1 $2 $3}'
		i=$[$i+1]
		sleep 1
	done
fi
